package com.yohann.designPattern.prototype.clone;

/**
 * <p>
 * 客户端
 * </p>
 *
 * @author Yohann
 * @since 2021/2/2 15:19
 */
public class Client {
    public static void main(String[] args) throws CloneNotSupportedException {
        Sheep sheep = new Sheep("pony", "yellow");
        Sheep clone1 = (Sheep) sheep.clone();
        Sheep clone2 = (Sheep) sheep.clone();

        /*
        clone1:Sheep{name='pony', color='yellow'}
        clone2:Sheep{name='pony', color='yellow'}
        false
         */
        System.out.println("clone1:" + clone1);
        System.out.println("clone2:" + clone2);
        System.out.println(clone1.equals(clone2));
    }
}